    $(function() {
        $('#userName').focus();
    })

    function login() {
        var info = localStorage['userInfos']
        if (info == null) {
            alert('没有用户,请先去注册')
        } else {
            var userInfos = JSON.parse(localStorage['userInfos']);
            for (var i = 0; i < userInfos.length; i++) {
                var name = userInfos[i].userName;
                var pwd = userInfos[i].userPassword;
                console.log(name)
                console.log(pwd)
                if (($('#userName').val() == name) && ($('#userPassword').val() == pwd)) {
                    var users = []
                    users.push({ "Name": name });
                    sessionStorage['users'] = JSON.stringify(users);
                    location.href = 'index.html'
                    return;
                } else {
                    continue;
                }
            }
            alert('用户名或密码错误')
        }
    }